//
//  NewsCell.m
//  MyMovie
//
//  Created by Weiwei on 16/3/5.
//  Copyright © 2016年 bever贝沃汇力 weiwei. All rights reserved.
//

#import "NewsCell.h"

@implementation NewsCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModel:(NewsModel *)model{
    
    _model = model;
    
    
    
    //------------------------------

//    
//    @property (weak, nonatomic) IBOutlet UILabel *time_2;
//    
//    @property (weak, nonatomic) IBOutlet UILabel *commentCount_2;
    
//    
//    @property(nonatomic,strong)NSNumber * type,*publishTime,*commentCount;
//    @property(nonatomic,copy)NSString* image,*title,*title2;
//    @property(nonatomic,copy)NSArray*images;
    if ([_model.type integerValue] == 1) {
        
        self.title_2.text = _model.title;
        
        //图片
        NSDictionary* imagDic1 = _model.images[0];
        NSString* url = [imagDic1 objectForKey:@"url1"];
        [self.image1_2 setImageWithURL:[NSURL URLWithString:url]];
        
        [self.image2_2 setImageWithURL:[NSURL URLWithString:[_model.images[1] objectForKey:@"url1"]]];
        
        [self.image3_2 setImageWithURL:[NSURL URLWithString:[_model.images[2] objectForKey:@"url1"]]];
        
        //评论数
        self.commentCount_2.text = [NSString stringWithFormat:@"%@条评论",_model.commentCount];
        
        
        // 1435746696
        float time =  [_model.publishTime floatValue]/36000000;
        self.time_2.text = [NSString stringWithFormat:@"%.1f小时前",time];
        
        
    }else{
        [self.image_1 setImageWithURL:[NSURL URLWithString:_model.image]];
        
        self.title_1.text = _model.title;
        
        self.title2_1.text = _model.title2;
        
        //  1435746696
        float time = [_model.publishTime floatValue]/36000000;
        
        self.time_1.text = [NSString stringWithFormat:@"%.1f小时前",time];
        
        self.commentCount_1.text = [NSString stringWithFormat:@"%@条评论",_model.commentCount];
    }
    
    
    
    
    
    
    //--------------------------
    
    
    
    
    
}



@end
